home *** CD-ROM | disk | FTP | other *** search
/ IRIX Installation Tools & Overlays 2002 November / SGI IRIX Installation Tools & Overlays 2002 November - Disc 4.iso / dist / motif21_dev.idb / usr / Motif-2.1 / include / Xm / ContainerP.h.z / ContainerP.h
C/C++ Source or Header  |  2002-10-15  |  14KB  |  388 lines

  1. /* $XConsortium: ContainerP.h /main/8 1996/06/13 16:45:53 pascale $ */
  2. /*
  3.  *  @OSF_COPYRIGHT@
  4.  *  COPYRIGHT NOTICE
  5.  *  Copyright (c) 1990, 1991, 1992, 1993 Open Software Foundation, Inc.
  6.  *  ALL RIGHTS RESERVED (MOTIF). See the file named COPYRIGHT.MOTIF for
  7.  *  the full copyright text.
  8.  */
  9. /*
  10.  * HISTORY
  11.  */
  12. #ifndef    _XmContainerP_h
  13. #define _XmContainerP_h
  14.  
  15. #include <Xm/XmP.h>
  16. #include <Xm/ManagerP.h>
  17. #include <Xm/DragCP.h>
  18. #include <Xm/Container.h>
  19.  
  20. #ifdef __cplusplus
  21. extern "C" {
  22. #endif
  23.  
  24. /*
  25.  * One _XmCwidNodeRec structure is allocated by Container for each of 
  26.  * it's children (except for OutlineButtons).  Information about the 
  27.  * relationship of the child to other Container children (parentage and
  28.  * order) is maintained here by Container.
  29.  *
  30.  * _XmCwidNodeRec structures are XtCalloc'd by Container in the 
  31.  * ConstraintInitialize method and XtFree'd in the ConstraintDestroy method.
  32.  * They are linked/unlinked to other _XmCwidNodeRec structures in the
  33.  * ChangeManaged method.
  34.  */
  35. typedef struct _XmCwidNodeRec
  36.         {
  37.     struct    _XmCwidNodeRec *    next_ptr;
  38.     struct    _XmCwidNodeRec *    prev_ptr;
  39.     struct    _XmCwidNodeRec *    child_ptr;
  40.     struct    _XmCwidNodeRec *    parent_ptr;
  41.     Widget            widget_ptr;
  42.     }    XmCwidNodeRec, *CwidNode;
  43.  
  44. /*
  45.  * Container allocates a _XmContainerXfrActionRec structure to store
  46.  * the data from a ContainerStartTransfer action until it can determine
  47.  * whether the action should start a primary transfer or begin a drag.
  48.  */
  49. typedef    struct    _XmContainerXfrActionRec
  50.     {
  51.     Widget        wid;
  52.     XEvent        *event;
  53.     String        *params;
  54.     Cardinal    *num_params;
  55.     Atom        operation;
  56.     }    XmContainerXfrActionRec, *ContainerXfrAction;
  57.  
  58. /*
  59.  * Container allocates an array of _XmContainerCwidCellInfoRec structures
  60.  * to use in calculating an ideal size in the GetSpatialSize procedure when
  61.  * XmNspatialStyle is XmCELLS.  The array is created and destroyed in the 
  62.  * GetSpatialSize procedure.
  63.  */
  64. typedef    struct    _XmContainerCwidCellInfoRec
  65.     {
  66.     int    cwid_width_in_cells;
  67.     int    cwid_height_in_cells;
  68.     }    XmContainerCwidCellInfoRec, *ContainerCwidCellInfo;
  69.  
  70. /* Container constraint class part record */
  71. typedef    struct    _XmContainerConstraintPart
  72.     {
  73.     Widget        entry_parent;        /* XmNentryParent */
  74.     Widget        related_cwid;
  75.     CwidNode    node_ptr;
  76.     int        position_index;        /* XmNpositionIndex */
  77.     int        depth;
  78.     int        cell_idx;
  79.     Boolean        visible_in_outline;
  80.     Position    user_x;
  81.     Position    user_y;
  82.     unsigned char    outline_state;        /* XmNoutlineState */
  83.     unsigned char    selection_visual;
  84.     unsigned char    selection_state;
  85.     unsigned char    cwid_type;
  86.     }    XmContainerConstraintPart, * XmContainerConstraint;
  87.  
  88. typedef    struct    _XmContainerConstraintRec
  89.     {
  90.     XmManagerConstraintPart        manager;
  91.     XmContainerConstraintPart    container;
  92.     }    XmContainerConstraintRec, * XmContainerConstraintPtr;
  93.  
  94. /* move the other typedef here */
  95. typedef void (*XmSpatialGetSize)(Widget, Dimension *, Dimension *);
  96.  
  97. /* Container widget class record  */
  98. typedef    struct    _XmContainerClassPart
  99.     {
  100.     XmSpatialTestFitProc        test_fit_item;
  101.     XmSpatialPlacementProc        place_item;
  102.     XmSpatialRemoveProc        remove_item;
  103.     XmSpatialGetSize        get_spatial_size;
  104.     XtPointer            extension;
  105.     
  106. #ifdef _SGIMOTIF
  107.     XtPointer    _SG_vendorExtension;
  108. #endif
  109.  
  110.     }    XmContainerClassPart;
  111.  
  112. /* Full class record declaration */
  113. typedef    struct    _XmContainerClassRec
  114.     {
  115.     CoreClassPart        core_class;
  116.     CompositeClassPart      composite_class;
  117.     ConstraintClassPart    constraint_class;
  118.     XmManagerClassPart    manager_class;
  119.     XmContainerClassPart        container_class;
  120.     }    XmContainerClassRec, *XmContainerClass;
  121.  
  122. externalref    XmContainerClassRec    xmContainerClassRec;
  123.  
  124. /* Container instance record */
  125. typedef    struct    _XmContainerPart
  126.     {
  127.     WidgetList      selected_items;         /* XmNselectedItems */
  128.     Widget        icon_header;
  129.     Widget        anchor_cwid;
  130.     Widget        druggee;
  131.     Widget        size_ob;
  132.     Widget        drag_context;
  133.     CwidNode        first_node;
  134.         CwidNode        last_node;
  135.     Cardinal *      detail_order;           /* XmNdetailOrder */
  136.     XmString *    detail_heading;         /* XmNdetailColumnHeading */
  137.     XSegment *      outline_segs;
  138.     XtCallbackList  convert_cb;             /* XmNconvertCallback */
  139.         XtCallbackList  default_action_cb;      /* XmNdefaultActionCallback */
  140.         XtCallbackList  destination_cb;         /* XmNdestinationCallback */
  141.     XtCallbackList  outline_cb;             /* XmNoutlineChangedCallback */
  142.     XtCallbackList  selection_cb;           /* XmNselectionCallback */
  143.     XmTabList       detail_tablist;         /* XmNdetailTabList */
  144.     XmFontList      render_table;           /* XmNfontList */
  145.     Pixel        select_color;        /* XmNselectColor */
  146.     Pixmap        collapsed_state_pixmap;    /* XmNcollapsedStatePixmap */
  147.     Pixmap        expanded_state_pixmap;    /* XmNexpandedStatePixmap */
  148.     GC        normalGC;
  149.     GC              marqueeGC;
  150.         Time            last_click_time;
  151.     Region        cells_region;
  152.     ContainerXfrAction transfer_action;
  153.     XtIntervalId    transfer_timer_id;
  154.     XPoint        anchor_point;
  155.     XPoint        marquee_start;
  156.     XPoint        marquee_end;
  157.     XPoint        marquee_smallest;
  158.     XPoint        marquee_largest;
  159.     XPoint        dropspot;
  160.     unsigned long    dynamic_resource;
  161.     int        max_depth;
  162.     int        outline_seg_count;
  163.     int         *cells;
  164.     int        cell_count;
  165.     int        next_free_cell;
  166.     int        current_width_in_cells;
  167.     int        current_height_in_cells;
  168.     int        drag_offset_x;
  169.     int        drag_offset_y;
  170.     unsigned int    selected_item_count;    /* XmNselectedItemCount */
  171.     Cardinal        detail_heading_count; /* XmNdetailColumnHeadingCount */
  172.         Cardinal        saved_detail_heading_count; 
  173.         Cardinal        detail_order_count;     /* XmNdetailOrderCount */
  174.     Dimension       first_col_width;        /* XmNoutlineColumnWidth */
  175.     Dimension       real_first_col_width;    
  176.     Dimension       large_cell_height;      /* XmNlargeCellHeight */
  177.         Dimension       large_cell_width;       /* XmNlargeCellWidth */
  178.     Dimension    small_cell_height;    /* XmNsmallCellHeight */
  179.     Dimension    small_cell_width;    /* XmNsmallCellWidth */
  180.     Dimension    real_large_cellh;
  181.     Dimension    real_large_cellw;
  182.     Dimension    real_small_cellh;
  183.     Dimension    real_small_cellw;
  184.         Dimension       margin_h;               /* XmNmarginHeight */
  185.         Dimension       margin_w;               /* XmNmarginWidth */
  186.         Dimension       outline_indent;         /* XmNoutlineIndentation */
  187.     Dimension       ob_width;
  188.     Dimension       ob_height;
  189.     Dimension       prev_width;
  190.         Dimension       ideal_width;
  191.         Dimension       ideal_height;
  192.     /* Note: first_change_managed is also used to resolve between
  193.      * XmRenderTable & XmFontList when setting up the resource table
  194.      */
  195.     Boolean        first_change_managed;
  196.     Boolean         extending_mode;
  197.         Boolean         marquee_mode;
  198.         Boolean         self;
  199.         Boolean         toggle_pressed;
  200.         Boolean         extend_pressed;
  201.     Boolean        ob_pressed;
  202.         Boolean         cancel_pressed;
  203.         Boolean         kaddmode;
  204.         Boolean         no_auto_sel_changes;
  205.         Boolean         started_in_anchor;
  206.     Boolean         marquee_drawn;
  207.     Boolean         have_primary;
  208.     Boolean         selecting;
  209.     Boolean        large_cell_dim_fixed;
  210.     Boolean        small_cell_dim_fixed;
  211.     unsigned char   automatic;              /* XmNautomaticSelection */
  212.     unsigned char   entry_viewtype;         /* XmNentryViewType */
  213.     unsigned char   include_model;          /* XmNspatialIncludeModel */
  214.         unsigned char   layout_type;            /* XmNlayoutType */
  215.     unsigned char   ob_policy;             /* XmNoutlineButtonPolicy */
  216.     unsigned char   outline_sep_style;      /* XmNoutlineLineStyle */
  217.         unsigned char   spatial_style;          /* XmNspatialStyle */
  218.         unsigned char   primary_ownership;      /* XmNprimaryOwnership */
  219.         unsigned char   resize_model;           /* XmNspatialResizeModel */
  220.     unsigned char   selection_policy;       /* XmNselectionPolicy */
  221.         unsigned char   selection_technique;    /* XmNselectionTechnique */
  222.     unsigned char   snap_model;             /* XmNspatialSnapModel */
  223.     unsigned char   create_cwid_type;
  224.         unsigned char   selection_state;
  225.     unsigned char    LeaveDir;               /* leave direction */
  226.     XtIntervalId    scroll_proc_id;         /* scroll TimeOutProc */
  227.     int             last_xmotion_x;
  228.     int             last_xmotion_y;
  229.     XmString *    cache_detail_heading;  /* XmNdetailColumnHeading 
  230.                           getValues */
  231.     
  232. #ifdef _SGIMOTIF
  233.     XtPointer    _SG_vendorExtension;
  234. #endif
  235.  
  236.     }    XmContainerPart;
  237.  
  238. /* Full instance record declaration */
  239. typedef    struct    _XmContainerRec
  240.     {
  241.     CorePart    core;
  242.     CompositePart   composite;
  243.     ConstraintPart    constraint;
  244.     XmManagerPart    manager;
  245.     XmContainerPart    container;
  246.     }    XmContainerRec;
  247.  
  248. /* enums to keep up with cwid types */
  249. enum {    CONTAINER_ICON,
  250.     CONTAINER_OUTLINE_BUTTON,
  251.     CONTAINER_HEADER};
  252.  
  253. #define    TABLIST    (1L<<0)
  254. #define    FIRSTCW (1L<<1)
  255. #define    CtrIsDynamic(w,mask) \
  256.     (((XmContainerWidget)(w))->container.dynamic_resource & mask)
  257.  
  258. #define CtrDynamicSmallCellHeight(w) \
  259.     (((XmContainerWidget)(w))->container.small_cell_height == 0)
  260. #define    CtrDynamicSmallCellWidth(w) \
  261.     (((XmContainerWidget)(w))->container.small_cell_width == 0)
  262. #define CtrDynamicLargeCellHeight(w) \
  263.         (((XmContainerWidget)(w))->container.large_cell_height == 0)
  264. #define CtrDynamicLargeCellWidth(w) \
  265.         (((XmContainerWidget)(w))->container.large_cell_width == 0)
  266.  
  267. #define CtrIsAUTO_SELECT(w) \
  268.         ((((XmContainerWidget)(w))->container.automatic == XmAUTO_SELECT) && \
  269.          (((XmContainerWidget)(w))->container.selection_policy \
  270.                                                         != XmSINGLE_SELECT))
  271. #define    CtrViewIsLARGE_ICON(w) \
  272.     (((XmContainerWidget)(w))->container.entry_viewtype == XmLARGE_ICON)
  273. #define CtrViewIsSMALL_ICON(w) \
  274.     (((XmContainerWidget)(w))->container.entry_viewtype == XmSMALL_ICON)
  275. #define    CtrViewIsANY_ICON(w) \
  276.     (((XmContainerWidget)(w))->container.entry_viewtype == XmANY_ICON)
  277. #define    CtrIsHORIZONTAL(w) \
  278.     (XmDirectionMatchPartial \
  279.     (((XmContainerWidget)(w))->manager.string_direction,\
  280.                 XmDEFAULT_DIRECTION,XmPRECEDENCE_HORIZ_MASK))
  281. #define    CtrIsVERTICAL(w) \
  282.     (XmDirectionMatchPartial \
  283.     (((XmContainerWidget)(w))->manager.string_direction,\
  284.                 XmDEFAULT_DIRECTION,XmPRECEDENCE_VERT_MASK))
  285. #define    CtrLayoutIsDETAIL(w) \
  286.     (((XmContainerWidget)(w))->container.layout_type == XmDETAIL)
  287. #define CtrLayoutIsOUTLINE_DETAIL(w) \
  288.     ((((XmContainerWidget)(w))->container.layout_type == XmDETAIL) || \
  289.     (((XmContainerWidget)(w))->container.layout_type == XmOUTLINE))
  290.  
  291. #define CtrDrawLinesOUTLINE(w) \
  292.     (CtrLayoutIsOUTLINE_DETAIL(w) && \
  293.      (((XmContainerWidget)(w))->container.outline_sep_style \
  294.                     == XmSINGLE))
  295. #define CtrLayoutIsSPATIAL(w) \
  296.     (((XmContainerWidget)(w))->container.layout_type == XmSPATIAL)
  297. #define    CtrSpatialStyleIsNONE(w) \
  298.     (((XmContainerWidget)(w))->container.spatial_style == XmNONE)
  299. #define CtrSpatialStyleIsGRID(w) \
  300.     (((XmContainerWidget)(w))->container.spatial_style == XmGRID)
  301. #define CtrSpatialStyleIsCELLS(w) \
  302.     (((XmContainerWidget)(w))->container.spatial_style == XmCELLS)
  303. #define    CtrIncludeIsAPPEND(w) \
  304.     (((XmContainerWidget)(w))->container.include_model == XmAPPEND)
  305. #define    CtrIncludeIsCLOSEST(w) \
  306.     (((XmContainerWidget)(w))->container.include_model == XmCLOSEST)
  307. #define    CtrIncludeIsFIRST_FIT(w) \
  308.     (((XmContainerWidget)(w))->container.include_model == XmFIRST_FIT)
  309. #define    CtrSnapModelIsNONE(w) \
  310.     (((XmContainerWidget)(w))->container.snap_model == XmNONE)
  311. #define CtrSnapModelIsSNAP(w) \
  312.     (((XmContainerWidget)(w))->container.snap_model == XmSNAP_TO_GRID)
  313. #define CtrSnapModelIsCENTER(w) \
  314.     (((XmContainerWidget)(w))->container.snap_model == XmCENTER)
  315. #define    CtrResizeModelIsGROW_MINOR(w) \
  316.     (((XmContainerWidget)(w))->container.resize_model == XmGROW_MINOR)
  317. #define CtrResizeModelIsGROW_MAJOR(w) \
  318.     (((XmContainerWidget)(w))->container.resize_model == XmGROW_MAJOR)
  319. #define CtrResizeModelIsGROW_BALANCED(w) \
  320.     (((XmContainerWidget)(w))->container.resize_model == XmGROW_BALANCED)
  321. #define    CtrPolicyIsSINGLE(w) \
  322.     (((XmContainerWidget)(w))->container.selection_policy \
  323.                     == XmSINGLE_SELECT)
  324. #define    CtrPolicyIsBROWSE(w) \
  325.     (((XmContainerWidget)(w))->container.selection_policy \
  326.                     == XmBROWSE_SELECT)
  327. #define    CtrPolicyIsMULTIPLE(w) \
  328.     (((XmContainerWidget)(w))->container.selection_policy \
  329.                     == XmMULTIPLE_SELECT)
  330. #define    CtrPolicyIsEXTENDED(w) \
  331.     (((XmContainerWidget)(w))->container.selection_policy \
  332.                     == XmEXTENDED_SELECT)
  333. #define    CtrTechIsTOUCH_OVER(w) \
  334.     (((XmContainerWidget)(w))->container.selection_technique \
  335.                     == XmTOUCH_OVER)
  336. #define    CtrTechIsTOUCH_ONLY(w) \
  337.     (((XmContainerWidget)(w))->container.selection_technique \
  338.                     == XmTOUCH_ONLY)
  339. #define    CtrTechIsMARQUEE(w) \
  340.     (((XmContainerWidget)(w))->container.selection_technique \
  341.                     == XmMARQUEE)
  342. #define CtrTechIsMARQUEE_ES(w) \
  343.     (((XmContainerWidget)(w))->container.selection_technique \
  344.                     == XmMARQUEE_EXTEND_START)
  345. #define    CtrTechIsMARQUEE_EB(w) \
  346.     (((XmContainerWidget)(w))->container.selection_technique \
  347.                     == XmMARQUEE_EXTEND_BOTH)
  348. #define    CtrOB_PRESENT(w) \
  349.     (((XmContainerWidget)(w))->container.ob_policy \
  350.                     == XmOUTLINE_BUTTON_PRESENT)
  351. #define    CtrOB_ABSENT(w) \
  352.     (((XmContainerWidget)(w))->container.ob_policy \
  353.                     == XmOUTLINE_BUTTON_ABSENT)
  354. #define GetContainerConstraint(w) \
  355.     (&((XmContainerConstraintPtr) (w)->core.constraints)->container)
  356. #define    CtrItemIsPlaced(w) \
  357.     (((XmContainerConstraintPtr)(w)->core.constraints)->container.cell_idx \
  358.                     != NO_CELL)
  359. #define    CtrICON(w) \
  360.     (((XmContainerConstraintPtr)(w)->core.constraints)->container.cwid_type\
  361.                     == CONTAINER_ICON)
  362. #define CtrOUTLINE_BUTTON(w) \
  363.     (((XmContainerConstraintPtr)(w)->core.constraints)->container.cwid_type\
  364.                     == CONTAINER_OUTLINE_BUTTON)
  365. #define    CtrHEADER(w) \
  366.     (((XmContainerConstraintPtr)(w)->core.constraints)->container.cwid_type\
  367.                     == CONTAINER_HEADER)
  368.  
  369. #define    XmInheritSpatialTestFitProc    ((XmSpatialTestFitProc) _XtInherit)
  370. #define    XmInheritSpatialPlacementProc    ((XmSpatialPlacementProc) _XtInherit)
  371. #define    XmInheritSpatialRemoveProc    ((XmSpatialRemoveProc) _XtInherit)
  372. #define    XmInheritSpatialGetSize        ((XmSpatialGetSize) _XtInherit)
  373.  
  374. /* possible directions when leaving the container */
  375. #define    TOPLEAVE    (1<<0)
  376. #define    BOTTOMLEAVE    (1<<1)
  377. #define    LEFTLEAVE    (1<<2)
  378. #define    RIGHTLEAVE    (1<<3)
  379.  
  380. #ifdef __cplusplus
  381. }  /* Close scope of 'extern "C"' declaration which encloses file. */
  382. #endif
  383.  
  384. #endif /* _XmContainerP_h */
  385. /* DON'T ADD ANYTHING AFTER THIS #endif */
  386.  
  387.  
  388.